/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package moyensDeTransport;

import java.awt.GridLayout;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author BENAMMAR Riyadh
 */
public class Bateau extends MoyensDeTransport{
    public String toString(){
        
        return "";
    }
    
    public double estimation(double distance){
        return distance/160;   // 160 km/h vitesse moyenne d'un bateau commercial
        
    }

    public JPanel getPanel() {
        JPanel panel=new JPanel();
        try {
            
            panel.setLayout(new GridLayout(8, 2));
            JLabel moyendeTransport=new JLabel("Moyen de transport: ");
            panel.add(moyendeTransport);
            BufferedImage myPicture = ImageIO.read(new File("ressources/icons/boat.png"));
            JLabel picLabel = new JLabel(new ImageIcon(myPicture));
            panel.add(picLabel);
            
            JLabel villeDepart=new JLabel("Ville départ: ");
            panel.add(villeDepart);
            
            JLabel villeDepartV=new JLabel(getAdresseDepart());
            panel.add(villeDepartV);
            
            JLabel dateDepart=new JLabel("Date départ: ");
            panel.add(dateDepart);
            SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
            
            JLabel dateDepartValue=new JLabel(dateFormat.format(getDateDebut()));
            panel.add(dateDepartValue);
            
            JLabel horaireDepart=new JLabel("Horaire départ: ");
            panel.add(horaireDepart);
            SimpleDateFormat dateFormat2 = new SimpleDateFormat("HH:mm");
            
            JLabel horaireDepartValue=new JLabel(dateFormat2.format(getDateDebut()));
            panel.add(horaireDepartValue);
            
            JLabel villeArrive=new JLabel("Ville arrivée: ");
            panel.add(villeArrive);
            
            JLabel villeArriveV=new JLabel(getAdresseArrivee());
            panel.add(villeArriveV);
            
            JLabel dateArrivee=new JLabel("Date arrivée: ");
            panel.add(dateArrivee);
            
            JLabel dateArriveValue=new JLabel(dateFormat.format(getDateFin()));
            panel.add(dateArriveValue);
            
            JLabel horaireArrivee=new JLabel("Horaire arrivée: ");
            panel.add(horaireArrivee);
            
            JLabel horaireArriveeValue=new JLabel(dateFormat2.format(getDateFin()));
            panel.add(horaireArriveeValue);
            
            JLabel prix=new JLabel("Prix: ");
            panel.add(prix);
            
            JLabel prixV=new JLabel(getPrix()+"");
            panel.add(prixV);
            
            
        } catch (IOException ex) {
            Logger.getLogger(Avion.class.getName()).log(Level.SEVERE, null, ex);
        }
        return panel;
    }

    public JButton getBouton() {
         BufferedImage myPicture=null;
        try {
            myPicture = ImageIO.read(new File("ressources/icons/boat.png"));
        } catch (IOException ex) {
            Logger.getLogger(Avion.class.getName()).log(Level.SEVERE, null, ex);
        }
        JButton bouton=new JButton(new ImageIcon(myPicture));
        return bouton;
    }
}
